<template>
  <ul class="tag-bar">
   <li
   v-for="(route, index) in tagRoutes"
   :key="route.path"
   :class="{active:currentIndex === index}"
   @click="jump(route.path,index)"
   >
       <i class="iconfont" v-html="route.meta.icon"></i>
       <span>{{route.meta.title}}</span>
    </li>

  </ul>
</template>

<script>
import routes from '@/router/routes'
export default {
  name: 'TagBar',
  data () {
    return {
      currentIndex: 0
    }
  },
  computed: {
    tagRoutes () {
      return routes.filter(route => route.meta && route.meta.isTag)
    }
  },
  methods: {
    jump (path, index) {
      this.currentIndex = index
      this.$router.push(path)
    }
  }
}
</script>

<style lang="less" >
@font-face {
  font-family: 'iconfont';  /* project id 2410190 */
  src: url('//at.alicdn.com/t/font_2410190_ln001tahrb8.eot');
  src: url('//at.alicdn.com/t/font_2410190_ln001tahrb8.eot?#iefix') format('embedded-opentype'),
  url('//at.alicdn.com/t/font_2410190_ln001tahrb8.woff2') format('woff2'),
  url('//at.alicdn.com/t/font_2410190_ln001tahrb8.woff') format('woff'),
  url('//at.alicdn.com/t/font_2410190_ln001tahrb8.ttf') format('truetype'),
  url('//at.alicdn.com/t/font_2410190_ln001tahrb8.svg#iconfont') format('svg');
}

.iconfont{
    font-family:"iconfont" !important;
    font-size:16px;font-style:normal;
    -webkit-font-smoothing: antialiased;
    -webkit-text-stroke-width: 0.2px;
    -moz-osx-font-smoothing: grayscale;
    }
.tag-bar {
  display: flex;
  border-top: 1px solid #eaeaea;

  li {
    flex: 1;
    height: 64px;
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    align-items: center;

    i {
      font-size: 32px;
    }

    &.active {
      color: #d81e06;
      font-weight: 700;
    }
  }
}
</style>
